<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">

    <head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>登录·数据工厂·管理页面端!</title>
        
        <!-- CSS -->
        <link href="${pageContext.request.contextPath }/img/webLogoIcon.png" rel="shortcut icon">
        <link rel="stylesheet" href="${pageContext.request.contextPath }/css/assets/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath }/css/assets/font-awesome/css/font-awesome.min.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath }/css/assets/css/style.css">
        
        <link href="${pageContext.request.contextPath }/css/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

        <!-- Favicon and touch icons -->
        <link rel="shortcut icon" href="assets/ico/favicon.png">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="${pageContext.request.contextPath }/css/assets/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="${pageContext.request.contextPath }/css/assets/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="${pageContext.request.contextPath }/css/assets/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="${pageContext.request.contextPath }/css/assets/ico/apple-touch-icon-57-precomposed.png">
        <link href="${pageContext.request.contextPath }/css/plugins/toastr/toastr.min.css" rel="stylesheet">
        
        <style type="text/css">
        	.footer{ left:0px; position:fixed; width:100%; height:100px;color:#FFF; text-align:center;bottom:-50px;}
        	button.btn {
				height: 40px;
			    margin: 0;
			    padding: 0 20px;
			    vertical-align: middle;
			    background: #19b9e7;
			    border: 0;
			    font-family: 'Roboto', sans-serif;
			    font-size: 14px;
			    font-weight: 400;
			    line-height: 40px;
			    color: #fff;
			    -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
			    text-shadow: none;
			    -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none;
			    -o-transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -ms-transition: all .3s; transition: all .3s;
			}
			
			button.btn:hover { opacity: 0.6; color: #fff; }
			
			button.btn:active { outline: 0; opacity: 0.6; color: #fff; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
			
			button.btn:focus { outline: 0; opacity: 0.6; background: #19b9e7; color: #fff; }
			
			button.btn:active:focus, button.btn.active:focus { outline: 0; opacity: 0.6; background: #19b9e7; color: #fff; }
        	.gxh{
        		height:40px;
        		margin: 0;
			    padding: 0 20px;
			    vertical-align: middle;
			    background: #fff;
			    border: 3px solid #fff;
			    font-family: 'Roboto', sans-serif;
			    font-size: 16px;
			    font-weight: 300;
			    line-height: 50px;
			    color: #888;
			    border-radius: 4px;
			    box-shadow: none;
			    transition: all .3s;
        	}
        </style>
        
    </head>

    <body>

		<!-- Top menu -->
		<nav class="navbar navbar-inverse navbar-no-bg" role="navigation">
			<div class="container">
				<div class="navbar-header">
					<img width="25px;" src="${pageContext.request.contextPath }/img/webLogoIcon.png" style="margin-top:-3px;">
					<span class="li-text" style="color:white;font-weight: bold;font-size: 20px;">思通数据</span>
				</div>
				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse" id="top-navbar-1">
					<ul class="nav navbar-nav navbar-right">
						<li>
							<span class="li-text">
<!-- 								让数据驱动投资价值， -->
							</span> 
							 
							<span class="li-text">
<!-- 							为<strong>专业投资</strong>提供全面的深度数据 -->
							</span> 
						</li>
					</ul>
				</div>
			</div>
		</nav>

        <!-- Top content -->
        <div class="top-content">
        	
            <div class="inner-bg">
                <div class="container">
                    <!-- <div class="row">
                        <div class="col-sm-8 col-sm-offset-2 text">
                            <h1><strong>Bootstrap</strong> Registration Form</h1>
                            <div class="description">
                            	<p>
	                            	This is a free responsive registration form made with Bootstrap. 
	                            	Download it on <a href="#"><strong>AZMIND</strong></a>, customize and use it as you like!
                            	</p>
                            </div>
                        </div>
                    </div> -->
                    <div class="row">
                    	<div class="col-sm-7 text" style="margin-top:10%;padding-right: 150px;">
                            <h1><strong>思通数据库</strong> 超算管理系统</h1>
                            <div class="description">
                            	<p style="line-height: 2.5;">
<!-- 	                            	整合海量全球宏观和行业爬虫数据, 数据及时准确,分析和图形功能强大<br />是经济学家、策略分析师、行业研究员必备的数据库系统 -->
                            	</p>
                            </div>
                            <!--
                            <div class="top-big-link">
                            	<a class="btn btn-link-1" href="http://demo.cssmoban.com/cssthemes4/azds_registration-forms/form-1/index.html#">Button 1</a>
                            	<a class="btn btn-link-2" href="http://demo.cssmoban.com/cssthemes4/azds_registration-forms/form-1/index.html#">Button 2</a>
                            </div>
                        -->
                        </div>
                        <div class="col-sm-5 form-box">
                        	<div class="form-top" style="height:98px;">
                        		<div class="form-top-left">
                        			<h3>用户登录</h3>
                            		<p style="font-size:12px;">技术驱动创新,让数据挖掘更简单</p>
                        		</div>
                            </div>
                            <div class="form-bottom">
		                    	<div class="form-group">
		                    		<label class="sr-only" for="form-first-name">用户</label>
		                        	<input type="text" name="form-first-name" placeholder="输入用户名称" class="form-first-name form-control gxh" id="username">
		                        </div>
		                        <div class="form-group">
		                        	<label class="sr-only" for="form-last-name">密码</label>
		                        	<input type="password" name="form-last-name" placeholder="输入登录密码" class="form-last-name form-control gxh" id="password">
		                        </div>
		                        <button type="button" class="ladda-button btn" style="margin-top:3%;">进入系统</button>
		                    </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer">
	        <small style="color: white;">© 2014-<span id="Full-Year"></span>&nbsp;&nbsp;|&nbsp;&nbsp;<a target="_blank" href="http://www.stonedt.com/" style="color:white;">南京涌亿思信息技术有限公司</a></small>
        </div>
</body>

        <!-- Javascript -->
        <script src="${pageContext.request.contextPath }/css/assets/js/jquery-1.11.1.min.js"></script>
        <script src="${pageContext.request.contextPath }/css/assets/bootstrap/js/bootstrap.min.js"></script>
        <script src="${pageContext.request.contextPath }/css/assets/js/jquery.backstretch.min.js"></script>
        <script src="${pageContext.request.contextPath }/css/assets/js/retina-1.1.0.min.js"></script>
        <script src="${pageContext.request.contextPath }/css/assets/js/scripts.js"></script>
        
        <!-- Toastr script -->
	    <script src="${pageContext.request.contextPath }/js/plugins/toastr/toastr.min.js"></script>
	    <!-- Ladda -->
	    <script src="${pageContext.request.contextPath }/js/plugins/ladda/spin.min.js"></script>
	    <script src="${pageContext.request.contextPath }/js/plugins/ladda/ladda.min.js"></script>
	    <script src="${pageContext.request.contextPath }/js/plugins/ladda/ladda.jquery.min.js"></script>
        
        <!--[if lt IE 10]>
            <script src="assets/js/placeholder.js"></script>
        <![endif]-->

	<script type="text/javascript">
	$(function(){
		$('.ladda-button').ladda();
		var d = new Date();
		document.getElementById("Full-Year").innerHTML = d.getFullYear();
	});
	
	$("body").keydown(function(event) {
		 if (event.keyCode == "13") {
			$(".ladda-button").click();
		 }
	}); 
	
	$('.ladda-button').click(function(){

        // Start loading
        $('.ladda-button').ladda( 'start' );
         /* setTimeout(function()
       		  $('.ladda-button').ladda('stop');
         },2000); */
		
		var username = $("#username").val();
		var password = $("#password").val();
		if(username == null || username == ''){
			toastr.options = {
                    closeButton: true,
                    progressBar: true,
                    showMethod: 'slideDown',
                    timeOut: 3000
                };
            toastr.error('用户名不能为空！');
			$('.ladda-button').ladda('stop');
			return;
		}
		if(password == null || password == ''){
			toastr.options = {
                    closeButton: true,
                    progressBar: true,
                    showMethod: 'slideDown',
                    timeOut: 3000
                };
            toastr.error('密码不能为空！');
			$('.ladda-button').ladda('stop');
			return;
		}
		var data= {username:username,password:password};
		
		$.ajax({
	        type:"POST",
	        url:"${pageContext.request.contextPath}/login",
	        data:data,
			dataType:'json',
			success:function(result){
		  		if(result.code=='1'){
		  			//管理员登陆成功
		  			<%--location.href = "${pageContext.request.contextPath}/admin/tosystem_overview";--%>
					location.href = "${pageContext.request.contextPath}/admin/website_admin";
				 }else if(result.code=='4'){
					//普通用户登陆成功
					<%-- location.href = "${pageContext.request.contextPath}/informationList/list?seed_id=197";--%>
					location.href = "${pageContext.request.contextPath}/admin/website_admin";
				}else if(result.code=='2'){
					toastr.options = {
		                    closeButton: true,
		                    progressBar: true,
		                    showMethod: 'slideDown',
		                    timeOut: 3000
		                };
					toastr.error('该用户已被停用,请联系管理员！');
					$('.ladda-button').ladda('stop');
					$("#password").val("");
				}else{
					toastr.options = {
		                    closeButton: true,
		                    progressBar: true,
		                    showMethod: 'slideDown',
		                    timeOut: 3000
		                };
					toastr.error('账号或密码错误！');
					$('.ladda-button').ladda('stop');
					$("#password").val("");
				}
			},
		});
	});
	
	
	//跑马灯方法 
// 	 function init(){
// 		    //获取标题
// 		    var title=document.title;
// 		    //分割字符串--->字符数组
// 		    var arr=title.split("");
// 		    //删除第一个元素并返回该元素
// 		    var e=arr.shift();
// 		    //把一个对象添加到数组末尾
// 		    arr.push(e);
// 		    //把数组转换成字符串
// 		    var marquee=arr.join("");
// 		    //返回给浏览器
// 		    document.title=marquee;
// 		    //定时一直执行
// 		    window.setTimeout("init()",1000);
// 		}
// 		window.onload=init;
	 
	</script>

</html>
